home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / misc1 / iv26_w30.zip / EXAMPLES / IDRAW / LISTCENT.H < prev    next >
C/C++ Source or Header  |  1980-01-05  |  3KB  |  87 lines

  1. /*
  2.  * Copyright (c) 1987, 1988, 1989 Stanford University
  3.  *
  4.  * Permission to use, copy, modify, distribute, and sell this software and its
  5.  * documentation for any purpose is hereby granted without fee, provided
  6.  * that the above copyright notice appear in all copies and that both that
  7.  * copyright notice and this permission notice appear in supporting
  8.  * documentation, and that the name of Stanford not be used in advertising or
  9.  * publicity pertaining to distribution of the software without specific,
  10.  * written prior permission.  Stanford makes no representations about
  11.  * the suitability of this software for any purpose.  It is provided "as is"
  12.  * without express or implied warranty.
  13.  *
  14.  * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  15.  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
  16.  * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  17.  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  18.  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  19.  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  20.  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  21.  */
  22.  
  23. // $Header: listcenter.h,v 1.8 89/10/09 14:48:38 linton Exp $
  24. // declares classes CenterNode and CenterList.
  25.  
  26. #ifndef listcenter_h
  27. #define listcenter_h
  28.  
  29. #include "list.h"
  30.  
  31. // A CenterNode contains two float values.
  32.  
  33. class CenterNode : public BaseNode {
  34. public:
  35.  
  36.     CenterNode (float x, float y) { cx = x; cy = y; }
  37.     float GetCx () { return cx; }
  38.     float GetCy () { return cy; }
  39.  
  40. protected:
  41.  
  42.     float cx, cy;        // stores a position
  43.  
  44. };
  45.  
  46. // A CenterList manages a list of CenterNodes.
  47.  
  48. class CenterList : public BaseList {
  49. public:
  50.  
  51.     CenterNode* First();
  52.     CenterNode* Last();
  53.     CenterNode* Prev();
  54.     CenterNode* Next();
  55.     CenterNode* GetCur();
  56.     CenterNode* Index(int);
  57.  
  58. };
  59.  
  60. // Cast these functions to return CenterNodes instead of BaseNodes.
  61.  
  62. inline CenterNode* CenterList::First () {
  63.     return (CenterNode*) BaseList::First();
  64. }
  65.  
  66. inline CenterNode* CenterList::Last () {
  67.     return (CenterNode*) BaseList::Last();
  68. }
  69.  
  70. inline CenterNode* CenterList::Prev () {
  71.     return (CenterNode*) BaseList::Prev();
  72. }
  73.  
  74. inline CenterNode* CenterList::Next () {
  75.     return (CenterNode*) BaseList::Next();
  76. }
  77.  
  78. inline CenterNode* CenterList::GetCur () {
  79.     return (CenterNode*) BaseList::GetCur();
  80. }
  81.  
  82. inline CenterNode* CenterList::Index (int index) {
  83.     return (CenterNode*) BaseList::Index(index);
  84. }
  85.  
  86. #endif
  87.